1. Field of the Invention
The present invention relates to a power supply voltage detection circuit and a power supply voltage detection method.
2. Description of the Related Art
An application, such as a micro computer driven by a battery or a computer installed in a car, in which a power supply voltage is changed, is operated on a system in which a power supply voltage is changed since a battery is used as a power supply, as disclosed in Japanese Laid Open Patent Application (JP-A-Heisei 10-136579), Japanese Laid Open Patent Application (JP-A-Heisei 11-223860) and the like. In recent years, a function of not only judging an allowance or rejection with regard to a voltage at one point, but also detecting a continuous power supply voltage is required in detecting a power supply voltage. For example, it is an essential function to indicate in detail the condition that a battery is an empty state, a full state, a middle state and a state close to an exhausted state. A voltage that can be detected by a known constant voltage detection circuit used to detect a power supply voltage is a voltage at only one point. It is difficult to monitor the change in the power supply voltage or its shift. In order to cope with a request of detecting the power supply voltages at a plurality of points necessary for the monitoring of the change and the shift in the power supply voltage, a plurality of detection circuits must be added and installed in a micro computer, in a case of the known circuit. Also, the detection voltage is only set at a time of a design. Thus, it is impossible to satisfy the usage environments and conditions of all users.
In a market in recent years, it is required to monitor the change and the shift in the power supply voltage. However, the conventional detection of the power supply voltage has been performed only on a voltage at one point. It is impossible to monitor the change and the shift in the power supply voltage.
Japanese Laid Open Patent Application (JP-A-Heisei 9-49868) discloses the following apparatus for detecting an exhausted battery. The apparatus for detecting the exhausted battery includes: a constant voltage generator for generating a constant voltage until a usage limit voltage of a battery; and an A/D converter for receiving an operational electric power from an electric power supply line in which it is dropped on the basis of an electric power exhaustion degree of the battery, and performing an A/D conversion on the constant voltage from the constant voltage generator, and it determines that the battery is exhausted if a digital data value into which the constant voltage is converted, on receipt of the A/D conversion value obtained from this A/D converter, is changed by a predetermined value or more.
Japanese Laid Open Patent Application (JP-A-Heisei 11-51985) discloses the following apparatus for detecting a power failure. In this apparatus for detecting the power failure, an A/D converter converts an instantaneous voltage of an alternating power supply into a digital value. A magnitude comparator, if the digital value is equal to or greater than a predetermined threshold, outputs it. An edge detector detects a rising edge and a trailing edge of an output wave form. A timer and an instantaneous power failure detection processor, if a period from the rising edge to the trailing edge (a voltage drop period) exceeds a first time limit T1, determine that it is the instantaneous power failure, and interrupt a main service. If the voltage drop period exceeds a second time limit T2 (T2 greater than T1), they determine that it is the power failure, and carry out a predetermined power failure process. When the electric power is recovered during the instantaneous power failure or the power failure, the process before the power failure is resumed.
Japanese Laid Open Patent Application (JP-A-Heisei 11-250940) discloses the following method of detecting a full charge in a battery charging operation. The method of detecting the full charge in the battery charging operation is carried out by using a |V| detection method of judging, on the basis of a voltage change amount, a process for detecting the full charge based on a software. In any measurement after a detection of a peak voltage in the charging operation, when a battery voltage is dropped from the peak voltage by |V| or more, it is assumed that the full charge is detected. At this time, a time from the detection of the peak voltage to the detection of the full charge is no matter. Also, after the detection of the peak voltage, if the battery voltage is dropped continuously a plurality of times in a periodical measurement, it is assumed to be the detection of the full charge, irrespectively of a drop width. Due to those operations, the detection change width of the battery voltage is expanded, which leads to the easy detection of the full charge. Thus, it is possible to relax an accuracy of an A/D converter for converting the battery voltage.
The present invention is accomplished in view of the above mentioned problems. Therefore, an object of the present invention is to provide a power supply voltage detection circuit and a power supply voltage detection method that can monitor a change and a shift in a power supply voltage by using an A/D converter as a circuit for detecting a power supply voltage.
Another object of the present invention is to provide a power supply voltage detection circuit and a power supply voltage detection method, in which a potential of a power supply voltage to be detected can be freely set, differently from a constant voltage detection circuit in which the potential is set when it is designed.
In order to achieve an aspect of the objects of the present invention, a power supply voltage detection circuit, includes: a constant voltage generator generating a first voltage of a constant voltage; an A/D converting unit performing an A/D conversion on the first voltage inputted through an analog input channel as a reference voltage of a second voltage of a power supply voltage; and an A/D conversion result register storing an A/D conversion result obtained by the A/D converting unit.
In this case, the power supply voltage detection circuit further includes: a selector selecting the analog input channel of a plurality of analog input channels.
Also in this case, the power supply voltage detection circuit further includes: a result comparison register setting an expectation value of a power supply voltage to be detected; and a judging circuit comparing the A/D conversion result with the expectation value to generate an interruption signal if a detection condition of the power supply voltage is satisfied.
Further in this case, the power supply voltage detection circuit further includes: a result comparison register setting an expectation value of a power supply voltage to be detected; and a judging circuit comparing the A/D conversion result with the expectation value to generate an interruption signal if a detection condition of the power supply voltage is satisfied.
In order to achieve another aspect of the objects of the present invention, a power supply voltage detection circuit, includes: a constant voltage generator generating a first voltage of a constant voltage; and an A/D converting unit inputting the first voltage and a second voltage whose voltage is detected to perform an A/D conversion on the first voltage based on the second voltage, and wherein the power supply voltage detection circuit detects the second voltage based on an A/D conversion result obtained by the A/D converting unit.
In order to achieve still another aspect of the objects of the present invention, a power supply voltage detection circuit, includes: a constant voltage generator generating a first voltage of a constant voltage; a first analog input channel; a second analog input channel, one of the first and second analog input channels inputting the first voltage from the constant voltage generator; a selector selecting an analog input channel of the first and second analog input channels; a reference voltage input terminal inputting a second voltage whose voltage is detected; and an A/D converting unit performing an A/D conversion on a voltage inputted to the analog input channel selected by the selector based on the second voltage, and the power supply voltage detection circuit detects the second voltage based on an A/D conversion result obtained by the A/D converting unit when the first analog input channel is selected by the selector.
In order to achieve yet still another aspect of the objects of the present invention, a power supply voltage detecting method, includes: (a) performing an A/D conversion on a constant voltage of an analog input channel to which the constant voltage generated by a constant voltage generator is applied; and (b) determining a value of a power supply voltage as an inverse operation based on an A/D conversion result obtained when the (a) is performed and a fact that a value of the constant voltage applied to the analog input channel is constant.
In this case, the power supply voltage detecting method further includes: (c) selecting an analog input channel to which a constant voltage generated by the constant voltage generator is applied of a plurality of analog input channels of an A/D converting unit; (d) setting an expectation value of a power supply voltage to be detected in a result comparison register; and (e) performing an A/D conversion on the constant voltage of the analog input channel and comparing the A/D conversion result with the expectation value to generate an interruption signal if a detection condition of the power supply voltage is satisfied.
Also in this case, the power supply voltage detecting method further includes: (f) the expectation value set for the result comparison register is updated every time the interruption signal is generated to monitor a change and a shift in the power supply voltage.
Further in this case, the power supply voltage detecting method further includes: (g) selecting the analog input channel to which the constant voltage generated by the constant voltage generator is applied of the plurality of analog input channels of the A/D converting unit at fixed intervals to monitor a change and a shift in the power supply voltage.
In this case, the power supply voltage detecting method further includes: (g) selecting the analog input channel to which the constant voltage generated by the constant voltage generator is applied of the plurality of analog input channels of the A/D converting unit at fixed intervals to monitor a change and a shift in the power supply voltage.
In order to achieve another aspect of the objects of the present invention, a computer readable recording medium for recording a program for a process, includes: (a) performing an A/D conversion on a constant voltage of an analog input channel to which the constant voltage generated by a constant voltage generator is applied; and (b) determining a value of a power supply voltage as an inverse operation based on an A/D conversion result obtained when the (a) is performed and a fact that a value of the constant voltage applied to the analog input channel is constant.
In this case, the computer readable recording medium for recording a program for a process, further includes: (c) selecting an analog input channel to which a constant voltage generated by the constant voltage generator is applied of a plurality of analog input channels of an A/D converting unit; (d) setting an expectation value of a power supply voltage to be detected in a result comparison register; and (e) performing an A/D conversion on the constant voltage of the analog input channel and comparing the A/D conversion result with the expectation value to generate an interruption signal if a detection condition of the power supply voltage is satisfied.
Also in this case, the computer readable recording medium for recording a program for a process, further includes: (f) the expectation value set for the result comparison register is updated every time the interruption signal is generated to monitor a change and a shift in the power supply voltage.
Further in this case, the computer readable recording medium for recording a program for a process, further includes: (g) selecting the analog input channel to which the constant voltage generated by the constant voltage generator is applied of the plurality of analog input channels of the A/D converting unit at fixed intervals to monitor a change and a shift in the power supply voltage.
In this case, the computer readable recording medium for recording a program for a process, further includes: (g) selecting the analog input channel to which the constant voltage generated by the constant voltage generator is applied of the plurality of analog input channels of the A/D converting unit at fixed intervals to monitor a change and a shift in the power supply voltage.
In order to enable the monitoring of the change and the shift in the power supply voltage that is the above-mentioned object, the power supply voltage detection circuit according to the present invention is characterized in that it includes a constant voltage generator (3) and it applies a constant voltage generated by the constant voltage generator (3) to an analog input channel (5) of an A/D converter (1), and connects a power supply voltage to an AVREF (4) as a reference voltage of the A/D converter (1) and carries out an A/D conversion, and then stores a result of the A/D conversion in an A/D conversion result register (8), and further determines the power supply voltage as an inverse operation since the applied voltage of the analog input channel (5) is constant from the A/D conversion result stored in the A/D conversion result register (8).
It includes a plurality of analog input channels (7) and a selector (6) for selecting one analog input channel from the plurality of analog input channels (7). The selector (6) selects the analog input channel (5), to which the constant voltage generated by the constant voltage generator (3) is applied, of the plurality of analog input channels (7). Then, the A/D conversion is carried out to determine the power supply voltage. The selection of the analog input channel (5) done by the selector (6) is periodically carried out by a CPU. Thus, the execution of the A/D conversion enables the power supply voltage to be continuously determined, and thereby enables the change and the shift in the power supply voltage to be monitored.
A result comparison register (9) for setting an expectation value of a power supply voltage to be detected, and a judging circuit (11) for comparing the A/D conversion result with the expectation value, and generating an interruption signal (10) if a detection condition of the power supply voltage is satisfied are added. Since the result comparison register (9) is installed, it is possible to freely set the expectation value of the power supply voltage to be detected. It is also possible to perform a predetermined process, such as an information escape and the like, on the power supply voltage detected from the generation of the interruption signal (10). After the completion of the predetermined process to the detected power supply voltage, an expectation value is newly set for the result comparison register (9), and a power supply voltage to the new expectation value is detected. An expectation value set for the result comparison register (9) is updated after each completion of the predetermined process to the detected power supply voltage. Then, the detection of the power supply voltage is repeated. Accordingly, it is possible to monitor the change and the shift in the power supply voltage.